using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._NetworkAnalystTools._Analysis
{
    /// <summary>
    /// <para>Solve</para>
    /// <para>Solves the network analysis layer problem based on its network locations and properties.</para>
    /// <para>根据网络位置和属性求解网络分析图层问题。</para>
    /// </summary>    
    [DisplayName("Solve")]
    public class Solve : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public Solve()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_network_analysis_layer">
        /// <para>Input Network Analysis Layer</para>
        /// <para>The network analysis layer on which the analysis will be computed.</para>
        /// <para>将在其上计算分析的网络分析图层。</para>
        /// </param>
        public Solve(object _in_network_analysis_layer)
        {
            this._in_network_analysis_layer = _in_network_analysis_layer;
        }
        public override string ToolboxName => "Network Analyst Tools";

        public override string ToolName => "Solve";

        public override string CallName => "na.Solve";

        public override List<string> AcceptEnvironments => ["workspace"];

        public override object[] ParameterInfo => [_in_network_analysis_layer, _ignore_invalids.GetGPValue(), _terminate_on_solve_error.GetGPValue(), _simplification_tolerance, _output_layer, _solve_succeeded, _overrides];

        /// <summary>
        /// <para>Input Network Analysis Layer</para>
        /// <para>The network analysis layer on which the analysis will be computed.</para>
        /// <para>将在其上计算分析的网络分析图层。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Network Analysis Layer")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_network_analysis_layer { get; set; }


        /// <summary>
        /// <para>Ignore Invalid Locations</para>
        /// <para><xdoc>
        ///   <para>Specifies whether invalid input locations will be ignored.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—The solver will skip over network locations that are unlocated and solve the analysis layer from valid network locations only. It will also continue solving if locations are on nontraversable elements or have other errors. This is useful if you know your network locations are not all correct, but you want to solve with the network locations that are valid. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—Do not solve if there are invalid locations. You can then correct these and rerun the analysis.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否忽略无效的输入位置。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 求解器将跳过未定位的网络位置，并仅从有效网络位置求解分析图层。如果位置位于不可遍历的元素上或存在其他错误，它还将继续求解。如果您知道您的网络位置并非全部正确，但您希望使用有效的网络位置进行求解，这将非常有用。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 如果存在无效位置，则不求解。然后，您可以更正这些问题并重新运行分析。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Ignore Invalid Locations")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _ignore_invalids_value _ignore_invalids { get; set; } = _ignore_invalids_value._true;

        public enum _ignore_invalids_value
        {
            /// <summary>
            /// <para>SKIP</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("SKIP")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>HALT</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("HALT")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Terminate on Solve Error</para>
        /// <para><xdoc>
        ///   <para>Specifies whether tool execution should terminate if an error is encountered during the solve.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—The tool will fail to execute when the solver encounters an error. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—The tool will not fail and continue execution even when the solver encounters an error. All of the error messages returned by the solver will be converted to warning messages. You should use this option when background processing is enabled in your application.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定在求解过程中遇到错误时是否应终止工具执行。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 当求解器遇到错误时，工具将无法执行。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 即使求解器遇到错误，工具也不会失败并继续执行。求解器返回的所有错误消息都将转换为警告消息。在应用程序中启用后台处理时，应使用此选项。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Terminate on Solve Error")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _terminate_on_solve_error_value _terminate_on_solve_error { get; set; } = _terminate_on_solve_error_value._true;

        public enum _terminate_on_solve_error_value
        {
            /// <summary>
            /// <para>TERMINATE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("TERMINATE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>CONTINUE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("CONTINUE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Simplification Tolerance</para>
        /// <para><xdoc>
        ///   <para>The tolerance that determines the degree of simplification for the output geometry. If a tolerance is specified, it must be greater than zero. You can choose a preferred unit; the default unit is decimal degrees.</para>
        ///   <para>Specifying a simplification tolerance tends to reduce the time it takes to render routes or service areas. The drawback, however, is that simplifying geometry removes vertices, which may lessen the spatial accuracy of the output at larger scales.</para>
        ///   <para>Because a line with only two vertices cannot be simplified any further, this parameter has no effect on drawing times for single-segment output, such as straight-line routes, OD cost matrix lines, and location-allocation lines.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>确定输出几何图形简化程度的公差。如果指定了公差，则该公差必须大于零。您可以选择首选单位;默认单位为十进制度。</para>
        ///   <para>指定简化容差往往会减少呈现路径或服务区域所需的时间。但是，缺点是简化几何会删除顶点，这可能会降低更大比例下输出的空间精度。</para>
        ///   <para>由于只有两个顶点的线无法进一步简化，因此此参数对单段输出（如直线路径、OD 成本矩阵线和位置分配线）的绘制时间没有影响。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Simplification Tolerance")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string? _simplification_tolerance { get; set; } = null;


        /// <summary>
        /// <para>Network Analyst Layer</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Network Analyst Layer")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _output_layer { get; set; }


        /// <summary>
        /// <para>Solve Succeeded</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Solve Succeeded")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _solve_succeeded { get; set; }


        /// <summary>
        /// <para>Overrides</para>
        /// <para><xdoc>
        ///   <para>Specify additional settings that can influence the behavior of the solver when finding solutions for the network analysis problems.</para>
        ///   <para>The value for this parameter needs to be specified in JavaScript Object Notation (JSON). For example, a valid value is of the following form {"overrideSetting1" : "value1", "overrideSetting2" : "value2"}. The override setting name is always enclosed in double quotation marks. The values can be either a number, Boolean, or a string.</para>
        ///   <para>The default value for this parameter is no value, which indicates not to override any solver settings.</para>
        ///   <para>Overrides are advanced settings that should be used only after careful analysis of the results obtained before and after applying the settings. A list of supported override settings for each solver and their acceptable values can be obtained by contacting Esri Technical Support.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定在查找网络分析问题的解决方案时可能影响求解程序行为的其他设置。</para>
        ///   <para>此参数的值需要在 JavaScript 对象表示法 （JSON） 中指定。例如，有效值的格式如下：{“overrideSetting1” ： “value1”， “overrideSetting2” ： “value2”}。替代设置名称始终用双引号括起来。这些值可以是数字、布尔值或字符串。</para>
        ///   <para>此参数的默认值为 no value，表示不覆盖任何求解器设置。</para>
        ///   <para>替代是高级设置，只有在仔细分析应用设置之前和之后获得的结果后，才应使用。可联系 Esri 技术支持获取每个求解器支持的覆盖设置列表及其可接受值。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Overrides")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _overrides { get; set; } = null;


        public Solve SetEnv(object workspace = null)
        {
            base.SetEnv(workspace: workspace);
            return this;
        }

    }

}